<html>
  <head>
    <script>
        var numBlurs = 0;

        function debug(str) {
            var c = document.getElementById('console')
            c.innerHTML += str + "<br>"

        }

        function finish() {
            var f = document.getElementById('f')

            f.innerHTML = '';

            if (numBlurs)
                debug('FAILURE: Onblur handler called!')
            else
                debug('SUCCESS!')
        }
    </script>
  </head>
<body>
    <p>This tests that elements shouldn't emit any onblur events when they are being removed from the document. To test this, click inside the input field. If If this test is successful, "SUCCESS" should be shown below, otherwise "FAILURE" is shown.</p>
    <form id='f'>
      <input onblur="numBlurs++" onfocus="setTimeout('finish()', 0)">
    </form>
    <pre id="console"></pre>
  </body>
</html>
